<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //replace('a','b')
        var str = 'sdfjsfhsdvjksd';
        console.log(str.replace('s', 'b')); //只能替换第一个字符

        //替换所有的
        for (var i = 0; i < str.length; i++) {
            while (str.indexOf('s') !== -1) {
                str = str.replace('s', '*');
            }
        }
        console.log(str);



        //字符转换为数组split('分隔符')
        var str = 'red,blue,pink';
        console.log(str.split(','));
        var str = 'red&blue&pink';
        console.log(str.split('&'));

    </script>
</head>

<body>

</body>

</html>